package com.example.design.responsibilityChainDemo;

public abstract class Responsibility {

    public abstract void deal();

    public Responsibility(Responsibility responsibility) {
        this.responsibility = responsibility;
    }

    public Responsibility() {
    }

    private Responsibility responsibility;


    public void setResponsibility(Responsibility responsibility) {
        this.responsibility = responsibility;
    }

    public void nextService() {
        if (responsibility != null) {
            responsibility.deal();
        }
    }
}
